<?php
/**
 * Created by PhpStorm.
 * User: sunku
 * Date: 2017/12/25
 * Time: 10:05
 */

namespace Admin\Transformer;
use Common\ORG\Util\Transformer;

class OrderBillTransformer extends Transformer
{
    public function transformer($item) {
        $statusList = C('BILL_STATUS');
        $typeList = C('BILL_TYPE');
        return [
            'id'=> intval($item['id']),
            'order_id' => intval($item['order_id']),
            'order_code' => strval($item['order_code']),
            'admin_id' => intval($item['admin_id']),
            'admin_name' => $item['admin_name']?strval($item['admin_name']):'',
            'department_name' => $item['department_name']?strval($item['department_name']):'',
            'department_id' => intval($item['department_id']),
            'customer_id' => intval($item['customer_id']),
            'company_name' => strval($item['company_name']),
            'item_name' => strval($item['item_name']),
            'item_type' => strval($item['item_type']),
            'description' => strval($item['description']),
            'taxpayer_id_number' => strval($item['taxpayer_id_number']),
            'address' => strval($item['address']),
            'bank' => strval($item['bank']),
            'bank_account' => strval($item['bank_account']),
            'mobile' => strval($item['mobile']),
            'contract' => strval($item['contract']),
            'contract_qualification' => strval($item['contract_qualification']),
            'order_protocol_number' => strval($item['order_protocol_number']),
            'bill' => strval($item['bill']),
            'materiel' => strval($item['materiel']),
            'remark' => strval($item['remark']),
            'send_type' => intval($item['send_type']),
            'amount' => $item['amount']?floatval($item['amount']):0.00,
            'order_rate' => $item['order_rate']?floatval($item['order_ratee']):0.00,
            'director_review' => intval($item['director_review']),
            'director_reason' => strval($item['director_reason']),
            'g_manager_review' => intval($item['g_manager_review']),
            'g_manager_reason' => strval($item['g_manager_reason']),
            'dp_manager_review' => intval($item['dp_manager_review']),
            'dp_manager_reason' => strval($item['dp_manager_reason']),
            'status' => intval($item['status']),
            'status_desc' => $statusList[$item['status']],
            'type' => intval($item['type']),
            'type_desc' => $typeList[$item['type']],
            'company_title' => strval($item['company_title']),
            'bill_title' => strval($item['bill_title']),
            'protocol_number' => strval($item['protocol_number']),
            'receipts_type' => strval($item['receipts_type']),
            'receipts_no' => strval($item['receipts_no']),
            'receipts_desc' => strval($item['receipts_desc']),
            'receipts_remark' => strval($item['receipts_remark']),
            'is_filing' => intval($item['is_filing']),
            'is_filing_desc' => ($item['is_filing']==1)?"已归档":"未归档",
            'arrival_time' => $item['arrival_time']?date('Y-m-d', $item['arrival_time']):'',
            'receipts_time' => $item['receipts_time']?date('Y-m-d', $item['receipts_time']):'',
            'create_time' => date('Y-m-d', $item['create_time']),
            'update_time' => date('Y-m-d', $item['update_time']),
        ];
    }
}